

void main ()
{
	while (1)
	{

		
	if (!PORTA.4)					//if door open
	{
		PORTB.2=1					//turn on light
	}
	else if (PORTA.4 && PORTB.2==1)	//if door closed and light on
	{
	 for (i=0;i<50000;)
    {
	i++;
    }								//end of for
	 PORTB.2=0						//turns of light
	}								//end if
	
	}								//end while
}									//end main